﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

using HHo_Model;
using HHo_Negocio;
using System.Collections.Generic;

public partial class mantenimientos_wfManConsultaComponente : System.Web.UI.Page
{
    E_Componente eComp;
    List<E_Componente> lst;
    GestorComponente oGestComp;

    protected void Page_Load(object sender, EventArgs e)
    {
        this.ClientScript.GetPostBackEventReference(this, string.Empty);
        if (Request.Form["__eventtarget"] == "ActualizarGrid")
        {
            try
            {
                gvData.DataSource = PoblarGrid();
                gvData.DataBind();
            }
            catch (Exception ex)
            {
                Response.Write("ERROR del sistema" + ex.Message);
            }
        }
        if (!Page.IsPostBack)
        {

        }
    }
    protected void imgConsultar_Click(object sender, ImageClickEventArgs e)
    {
        try
        {
            gvData.DataSource = PoblarGrid();
            gvData.DataBind();
        }
        catch (Exception ex)
        {
            Response.Write("ERROR del sistema: " + ex.Message);
        }
    }

    private List<E_Componente> PoblarGrid()
    {
        eComp = new E_Componente();
        eComp.CodigoAta = txtCodATA.Text;
        eComp.CodigoSubAta = txtCodSATA.Text;
        eComp.CodigoComponente = txtCodComp.Text;
        eComp.DescripcionComponente = txtDesc.Text;

        oGestComp = new GestorComponente();
        try
        {
            return oGestComp.Man_ConsultaComponente(eComp);
        }
        catch (Exception ex)
        {
            throw;
        }
    }
}
